﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace RegularExpressionTest
{
    public sealed class Util
    {
        public static void CopyTemplateToClipborad(string pattern)
        {
            string tmpl = "" +
                "//using System.Text.RegularExpressions;" + Environment.NewLine +
                Environment.NewLine +
                "Regex r;" + Environment.NewLine +
                "Match m;" + Environment.NewLine +
                "string pattern=@\"" + pattern + "\";" + Environment.NewLine +
                "string text=\"\";" + Environment.NewLine +
                "r = new Regex(pattern, RegexOptions.IgnoreCase);" + Environment.NewLine +
                "m = r.Match(text);" + Environment.NewLine +
                "if (m.Success)" + Environment.NewLine +
                "{" + Environment.NewLine +
                "\tstring m0 = m.Groups[1].Value;" + Environment.NewLine +
                "\tstring m1 = m.Groups[2].Value;" + Environment.NewLine +
                "}" + Environment.NewLine
                ;
            //
            Clipboard.SetText(tmpl, TextDataFormat.UnicodeText);
        }
    }//class
}//namespace
